/*
 * TestQuantity.cpp
 *
 *  Created on: 2015��3��5��
 *      Author: 10071867
 */

#include <gtest/gtest.h>

#include "length.h"
#include "vol.h"

class TestQuantity: public testing::Test {
public:
	void SetUp() {

	}
	void TearDown() {

	}
protected:
};

TEST_F(TestQuantity, 1_mile_equal_to_1_mile) {
	EXPECT_TRUE(Mile(1)==Mile(1));
}

TEST_F(TestQuantity, 1_mile_false_equal_3_mile) {
	EXPECT_FALSE(Mile(1)==Mile(3));
}

TEST_F(TestQuantity, 3_mile_unequal_1_mile) {
	EXPECT_TRUE(Mile(3)!=Mile(1));
}

TEST_F(TestQuantity, 1_yard_equal_to_1_yard) {
	EXPECT_TRUE(Yard(1)==Yard(1));
}

TEST_F(TestQuantity, 1_yard_false_equal_3_yard) {
	EXPECT_FALSE(Yard(1)==Yard(3));
}

TEST_F(TestQuantity, 3_yard_unequal_1_yard) {
	EXPECT_TRUE(Yard(3)!=Yard(1));
}

TEST_F(TestQuantity, 1_mile_equal_1760_yard) {
	EXPECT_TRUE(Mile(1)==Yard(1760));
}

TEST_F(TestQuantity, 3_mile_unequal_1760_yard) {
	EXPECT_TRUE(Mile(3)!=Yard(1760));
}

TEST_F(TestQuantity, 1760_yard_equal_1_mile) {
	EXPECT_TRUE(Yard(1760)==Mile(1));
}

TEST_F(TestQuantity, 1760_yard_unequal_3_mile) {
	EXPECT_TRUE(Yard(1760)!=Mile(3));
}

TEST_F(TestQuantity, 1_feet_equal_12_inch) {
	EXPECT_TRUE(Feet(1)==Inch(12));
}

TEST_F(TestQuantity, 1_yard_equal_3_feet) {
	EXPECT_TRUE(Yard(1)==Feet(3));
}
TEST_F(TestQuantity, 13inch_plus_11inch_eq_2feet) {
	EXPECT_TRUE(Inch(13)+Inch(11) == Feet(2));
}
TEST_F(TestQuantity, 3feet_plus_2yard_eq_3yard) {
	EXPECT_TRUE(Feet(3)+Yard(2)==Yard(3));
}
/*

 TEST_F(TestQuantity, new_unit_fault){
 #define MyUnit(x) Length(x, 100)
 EXPECT_TRUE(MyUnit(2) == Inch(200));
 }
 */

TEST_F(TestQuantity, 1_tbsp_equa_3_tsp) {
	EXPECT_TRUE(Tbsp(1)==Tsp(3));
}

TEST_F(TestQuantity, 1_oz_equa_2_tbsp) {
	EXPECT_TRUE(Oz(1)==Tbsp(2));
}

TEST_F(TestQuantity, 1_oz_equa_6_tsp) {
	EXPECT_TRUE(Oz(1)==Tsp(6));
}

TEST_F(TestQuantity, 3tsp_plus_1tbsp_equa_1oz) {
	EXPECT_TRUE((Tsp(3)+Tbsp(1)) == Oz(1));
}

//TEST_F(TestQuantity, 1mile_cannot_compare_with_1oz) {
//	EXPECT_FALSE(Mile(1) == Oz(1));
//}

TEST_F(TestQuantity, 12inch_tostr_1feet) {
	EXPECT_EQ("1 FEET", Inch(12).toStr());
}

TEST_F(TestQuantity, 1763yard_equ_1mile3yard){
	EXPECT_EQ("1 MILE 3 YARD", Yard(1763).toStr());
}

